/** @noSelfInFile **/
import {ColorStr} from "../../../../../type/Type";
import {PlayerModel} from "../../../adapterModel/model4/PlayerModel";

export let frameAdapter: { adapter: IFrameAdapter } = { adapter: undefined };

export interface FrameEvent {
    x: number;
    y: number;
    del?: number;
    player?: PlayerModel,
}

export interface IFrameAdapter {
    getRoot(): any;
    createFrame(id: string, parent: number): any;
    setBackImage(frame: any, path: string): void;
    setCenter(frame: any, textAlign: TextAlign): void;
    setBorder(frame: any, border: string): void;
    setSize(frame: any, height: number, width: number, borderWeight: number, padding: { t: number, r: number, b: number, l: number }): void;
    setText(frame: any, text: string, color: ColorStr): void;
    setTextSizeLimit(frame: any, size: number): void;
    setValue(frame: any, value: number): void;
    setMask(frame: any, path: string, flag?: number): void;
    setHidden(frame: any, flag: boolean, mask: string, backImage: string, border: string, text: string): void;
    cageMouse(frame: any, enable: boolean): void;
    clearPoints(frame: any): void;
    destroy(frame: any): void;
    setAbsPoint(frame: any, x: number, y: number, borderWeight: number, margin: { t: number, r: number, b: number, l: number }, padding: { t: number, r: number, b: number, l: number }): void;
    setAlpha(frame: any, alpha: number): void;
    setEnabled(frame: any, flag: boolean): void;
    setFocus(frame: any, flag: boolean): void;
    setFontStyle(frame: any, filename: string, height: number): void;
    setMinMaxValue(frame: any, minValue: number, maxValue: number): void;
    setModel(frame: any, modelFile: string, modelType: number, flag: number): void;
    setScale(frame: any, scale: number): void;
    setSpriteAnimate(frame: any, animId: number, autocast: boolean): void;
    setStepSize(frame: any, stepSize: number): void;
    setVertexColor(frame: any, color: number): void;
    setOnMouseDown(frame: any, callback: (pos: FrameEvent) => boolean, sync?: boolean): void;
    setOnMouseRightDown(frame: any, callback: (pos: FrameEvent) => boolean, sync?: boolean): void;
    setOnMouseUp(frame: any, callback: (pos: FrameEvent) => boolean, sync?: boolean): void;
    setOnDoubleClick(frame: any, callback: (pos: FrameEvent) => boolean, sync?: boolean): void;
    setOnMouseEnter(frame: any, callback: (pos: FrameEvent) => boolean, sync?: boolean): void;
    setOnMouseLeave(frame: any, callback: (pos: FrameEvent) => boolean, sync?: boolean): void;
    setOnMouseWheel(frame: any, callback: (pos: FrameEvent) => boolean, sync?: boolean): void;
    getTriggerPlayerId(): PlayerModel;
    initDefaultFrame(bAll: boolean): void;
    stopMouseClick(bool: boolean): void;
}

export enum TextAlign {
    before = 1,
    center,
    behind,
}